package com.itheima.controller;

import com.itheima.pojo.Emp;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/emps")
public class EmpController {

    @Autowired
    private EmpService empService;

    @GetMapping("/list")
    public Result<List<Emp>> list(String name , Integer gender , Integer job){
        List<Emp> empList = empService.list(name, gender, job);
        return Result.success(empList);
    }

    @PostMapping("/update")
    public Result<List<Emp>> update(Integer id){
        empService.update(id);
        return Result.success();
    }

}
